// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.commands.serverCommands;

import zombie.Lua.LuaManager;
import zombie.commands.CommandArgs;
import zombie.commands.CommandBase;
import zombie.commands.CommandHelp;
import zombie.commands.CommandName;
import zombie.commands.RequiredRight;
import zombie.core.raknet.UdpConnection;

@CommandName(
    name = "reloadlua"
)
@CommandArgs(
    required = {"(\\S+)"}
)
@CommandHelp(
    helpText = "UI_ServerOptionDesc_ReloadLua"
)
@RequiredRight(
    requiredRights = 32
)
public class ReloadLuaCommand extends CommandBase {
    public ReloadLuaCommand(String username, String userAccessLevel, String command, UdpConnection connection) {
        super(username, userAccessLevel, command, connection);
    }

    @Override
    protected String Command() {
        String string0 = this.getCommandArg(Integer.valueOf(0));

        for (String string1 : LuaManager.loaded) {
            if (string1.endsWith(string0)) {
                LuaManager.loaded.remove(string1);
                LuaManager.RunLua(string1, true);
                return "Lua file reloaded";
            }
        }

        return "Unknown Lua file";
    }
}
